<div class="form-container">
    <div class="box">
        <div class="row visa-row marginZero">
            <h4>当前语言标识：${lisFun.getCurLocale()}</h4>
        </div>
    </div>
    <div class="box">
        <div class="row visa-row marginZero">
            <h4>测试提示消息</h4>
        </div>
        <div class="row visa-row marginZero">
            <script type="text/javascript">
            function testAlertMsg(){
                showAlertMessage("alert-msg","Test alert message.");
            }
            function testToDoMsg(){
                clearTipMsgs(["wait-msg","alert-msg","error-msg"]);
                appendTipMessage("wait-msg","Test to do message.");
            }
            function testErrMsg(){
                showErrorMessage("error-msg","Test error message.");
            }
            </script>
            <div id="wait-msg" class="alert alert-info"
                     style="background:url(${baseStaticUrl}/images/ajax-loader.gif) no-repeat scroll 0.5em 50%;padding-left:25px;display:none"></div>
            <div id="alert-msg" class="alert alert-success" style="display:none;"></div>
            <div id="error-msg" class="alert alert-danger" style="display:none;"></div>
            <button type="button" class="btn btn-default" onclick="testAlertMsg();">Test Alert Message</button>
            <button type="button" class="btn btn-default" onclick="testToDoMsg();">Test To Do Message</button>
            <button type="button" class="btn btn-default" onclick="testErrMsg();">Test Error Message</button>
        </div>
    </div>
    <div class="box">
        <div class="row marginZero">
            <h4>测试select2</h4>
        </div>
        <div class="row marginZero">
            <h6>本地数据加载</h6>
            <div>
                <epoch:select2 id="select2Local" multiple="true" data="${selectData!}"></epoch:select2>
            </div>
        </div>
        <div class="row marginZero">
            <h6>url请求加载数据</h6>
            <div>
                <epoch:select2 id="select2Remote" multiple="true" type="remote" url="${basePath}/sys/test/select2"></epoch:select2>
            </div>
        </div>
    </div>
    <div class="box">
        <div class="row marginZero">
            <h4>测试uploader组件</h4>
        </div>
        <div class="row marginZero">
            <epoch:uploader id="testUploader" url="${basePath}/sys/test/testUpload" showDownload="true" />
        </div>
    </div>
    <div class="box">
        <div class="row marginZero">
            <h4>测试日期控件</h4>
        </div>
        <div class="row marginZero">
            <epoch:date id="sr" name="sysUser.BIRTHDAY" value="${sysUser.BIRTHDAY!}" format="yyyy-MM-dd HH:mm:ss"
                type="datetime"></epoch:date>
        </div>
        <br />
        <div class="row marginZero">
            <epoch:date id="sr2" name="sysUser.BIRTHDAY" value="${sysUser.BIRTHDAY!}" format="yyyy-MM-dd"
                type="date"></epoch:date>
        </div>
    </div>
    <br />
    <div class="box">
        <div class="row marginZero">
            <h4>测试commonTreePopup组件</h4>
        </div>
        <div class="row marginZero">
            <epoch:commonTreePopup id="testCommonTreePopup" treeData="${testTreeData}" callback="testCommonTreePopupCbk"
                multiple="true" onlyCheckLeaf="false" parentSubRelated="false" width="480px" title="树形弹窗" />
        </div>
        <div class="row marginZero">
            <h4>测试commonTreePopup组件可选状态控制</h4>
        </div>
        <div class="row marginZero">
            <script type="text/javascript">
            function setNodeSts(treeObj,node){
                var hasCheck = false;
                var children = node.children;
                if(node.checked){
                    //若当前节点被选中，则设置其本身为enable，设置其所有子节点为disable
                    hasCheck = true;
                    treeObj.setChkDisabled(node,false);
                    $.each(children,function(i,cnode){
                        treeObj.setChkDisabled(cnode,true,false,true);
                    });
                }else{
                    //若当前节点未选中，则先递归检查设置其所有子节点
                    $.each(children,function(i,cnode){
                        if(setNodeSts(treeObj,cnode)){
                            hasCheck = true; //若子节点中存在被选中节点，则设置含有选中项标志为true
                        }
                    });
                    //然后根据含有选中项标志，设置节点本身可选状态
                    treeObj.setChkDisabled(node,hasCheck);
                }
                return hasCheck; //返回此节点及所有子节点中是否有被选中项的标志
            }
            //控制节点可选状态
            function ctrlTreeNode(e,treeId,treeNode){
                var treeObj = $.fn.zTree.getZTreeObj(treeId);
                var rootNodes = treeObj.getNodes(); //获取所有根节点
                if(rootNodes != null){
                    var cnt = rootNodes.length;
                    var i = 0;
                    for(;i < cnt;i++){
                        var node = rootNodes[i];
                        setNodeSts(treeObj,node); //遍历根节点，递归检查并设置可选状态
                    }
                }
            }
            </script>
            <epoch:commonTreePopup id="testCommonTreePopupSts" treeData="${testTreeData}" callback="testCommonTreePopupCbk"
                multiple="true" onlyCheckLeaf="false" parentSubRelated="false" width="480px" treeSetting="{callback:{onCheck:ctrlTreeNode}}" title="树形弹窗" />
        </div>
    </div>
    <div class="box">
        <div class="row marginZero">
            <h4>测试commonAttach组件</h4>
        </div>
        <div class="row marginZero">
            <h6>业务单据ID：${commonAttachBusinessId}</h6>
            <epoch:commonAttach id="testCommonAttach" businessId="${commonAttachBusinessId}" showFileSize="true"
                showStatus="true" showUploadTime="true" showDescn="true" showProgress="true">
                <epoch:moreBtn>
                    <button class="btn btn-primary" onclick="testCommonAttachSave();">保存</button>
                </epoch:moreBtn>
            </epoch:commonAttach>
            <epoch:commonAttach id="testCommonAttachRead" businessId="${commonAttachBusinessId}" showFileSize="true"
                showStatus="true" showUploadTime="true" showDescn="true" showProgress="true" simpleMode="true" readonly="true" />
            <button class="btn btn-primary" onclick="refreshAttaches(_var_testCommonAttach_attach,_var_testCommonAttachRead_attach);">刷新</button>
        </div>
    </div>
    <div class="box">
        <div class="row marginZero">
            <h4>测试commonPopup组件</h4>
        </div>
        <div class="row marginZero">
            <input id="testCommonPopupBox1" type="text" style="width:500px;" readonly="readonly"/>
            <input id="testCommonPopupHide1" type="hidden"/>
            <epoch:commonPopup id="testCommonPopup1" sqlKey="test.test.meta3" callback="testCommonPopupCbk1" btnClickFunc="testCmnPopBtn1" multiple="true" showBack="true"/><br/>
            <input id="testCommonPopupBox2" type="text" style="width:500px;" readonly="readonly"/>
            <input id="testCommonPopupHide2" type="hidden"/>
            <epoch:commonPopup id="testCommonPopup2" sqlKey="test.test.meta3" callback="testCommonPopupCbk2" btnClickFunc="testCmnPopBtn2" multiple="false" showBack="true"/>
        </div>
    </div>
    <br />
    <div class="box">
        <div class="row marginZero">
            <h4>测试commonPopup组件自定义URL</h4>
        </div>
        <div class="row visa-row">
            <epoch:commonPopup id="testCommonPopupCustomUrl" sqlKey="test.testCustomUrl.meta" callback="testCommonPopupCbk1" multiple="true" />
        </div>
    </div>
</div>